﻿using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.IO;
using System.Text;
using WinDocker.Common.Global;

namespace WinDocker.BLL
{
    /// <summary>
    /// 
    /// </summary>
    public class DealBLL
    {
        /// <summary>
        /// 单例模式
        /// </summary>
        private static readonly DealBLL dealBLL = new DealBLL();
        /// <summary>
        /// 单例对像创建生成
        /// </summary>
        /// <returns></returns>
        public static DealBLL Init()
        {
            return dealBLL;
        }

        private DealBLL()
        {
            try
            {
                //this.Refresh();
            }
            catch (Exception ex)
            {
                LogWrite.TxtExport_DateNow("LogErr.txt", "DealBLL Err:" + ex.Message);
            }
        }

        /// <summary>
        /// 获取某设备服务是否启用
        /// </summary>
        /// <param name="sDir">设备服务程序的部署相对路径 如“Service\Deploy\KnDService\JtDFSer_Test.exe_0”</param>
        /// <returns></returns>
        public bool GetDevServiceEnagble(string sDir)
        {
            var bRet = false;
            try
            {
                var path = $@"{AppDomain.CurrentDomain.BaseDirectory}{sDir}";
                bRet = Directory.Exists(path);
            }
            catch (Exception ex)
            {
                LogWrite.TxtExport_DateNow("LogErr.txt", "DealBLL GetDevServiceEnagble Err:" + ex.Message);
            }
            return bRet;
        }



    }
}
